package com.myhome.money.demo.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HomeController {

    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
    private boolean useLocalCache;

    @Value("${nocosProperties:haha}")
    private String nacosTest;

    @RequestMapping(value = "/get")
    @ResponseBody
    public boolean get() {
        return useLocalCache;
    }

    @RequestMapping("index")
    public String index() {
        return "hello world!" + ";" + nacosTest;
    }

    public void setNacosTest(String nacosTest) {
        this.nacosTest = nacosTest;
    }
}
